SET EXCLU OFF
SET PROC TO SOSPRO
SET PROC TO BOXPROC
SET DATE BRITI
** PRINT OUT PHARMACY JUN 94 TO JUL 95
DR='Q:'
DR1='N:'
F1='ACT_PHA2'
F11='ACT2PHHL'
F2='PHARHL'
F3='DRUGS'
F4='DISPOS'
SELE 1
SET EXCLU OFF
USE &DR&F1 INDE &DR&F11
SET DEVI TO PRINT
SELE 2
SET EXCLU OFF
USE &DR&F2
SELE 3
SET EXCLU OFF
USE &DR1&F3 INDE &DR1&F3
SELE 4
SET EXCLU OFF
USE &DR1&F4 INDE &DR1&F4
SELE 1
GO TOP

* CODE   DESCRIPTION                     TOTAL PRICE           # OF USAGE
* XXXXX  XXXXXXXXXXXXXXXXXXXXXXXXXXXXX   999,999,999              999,999

@ 0, 2 SAY '      HEALTHLINE ACTIVITY FOR PERIOD '+CMONTH(DATE()-25)+' '+STR(YEAR(DATE()))
@ 2, 2 SAY 'CODE   DESCRIPTION                     TOTAL PRICE           # OF USAGE'
BR=4
GRTOT=0
DO WHILE .NOT. EOF()
   IF .NOT. HEALTHLINE
      SKIP
      LOOP
   ENDIF
   PHCD=PHAR_CODE
   SELE 3
   SEEK PHCD
   IF EOF()
      SELE 4
      SEEK PHCD
      IF EOF()
         PHNM=SPACE(20)
      ELSE
         PHNM=DISP_NAME
      ENDIF
   ELSE
      PHNM=DRUG_NAME
   ENDIF
   SELE 1
   TOTPRIC=0
   TOTQNTY=0
   DO WHILE PHAR_CODE=PHCD .AND. .NOT. EOF()
         IF .NOT. HEALTHLINE
            SKIP
            LOOP
         ENDIF
         GRTOT=GRTOT+PHAR_HL
         TOTPRIC=TOTPRIC+PHAR_HL
         TOTQNTY=TOTQNTY+PHAR_X
         SKIP
   ENDDO
   @ BR,2 SAY PHCD
   @ BR,9 SAY PHNM
   DO SAYG WITH BR,41,TOTPRIC,'9,999,999.99','999,999,999'
*   @ BR,41 SAY TOTPRIC PICT '999,999,999'
   @ BR,66 SAY TOTQNTY PICT '999,999'

   BR=BR+1
   SELE 2
   IF FIL_LOCK()
      APPE BLAN
   ENDIF
   IF REC_LOCK()
      REPL PHAR_CODE WITH PHCD, PHAR_NAME WITH PHNM, TOTA_PRIC WITH TOTPRIC
      REPL TOTA_USED WITH TOTQNTY
   ENDIF
   UNLOCK
   SELE 1
   IF BR>57
      @ 0, 2 SAY '      HEALTHLINE ACTIVITY FOR PERIOD '+CMONTH(DATE()-25)+' '+STR(YEAR(DATE()))
     @ 2, 2 SAY 'CODE   DESCRIPTION                     TOTAL PRICE           # OF USAGE'
      BR=4
   ENDIF
ENDDO
BR=BR+1
DO SAYG WITH BR,41,GRTOT,'9,999,999.99','999,999,999'
*@ BR,41 SAY GRTOT PICT '999,999,999'
SET DEVI TO SCREE
RETURN